$OpenBSD: patch-root-tail_c,v 1.4 2009/03/08 16:30:00 naddy Exp $
--- root-tail.c.orig	Fri Jul 30 21:33:20 2004
+++ root-tail.c	Sun Mar  8 16:54:40 2009
@@ -167,7 +167,7 @@ void transform_line (char *s);
 int lineinput (struct logfile_entry *);
 void reopen (void);
 void check_open_files (void);
-FILE *openlog (struct logfile_entry *);
+FILE *open_log (struct logfile_entry *);
 static void main_loop (void);
 
 void display_version (void);
@@ -235,7 +235,6 @@ find_root_window (Display *display, int screen_number)
     {
       Atom SWM_VROOT = XInternAtom (display, "__SWM_VROOT", False);
       Atom NAUTILUS_DESKTOP_WINDOW_ID = XInternAtom (display, "NAUTILUS_DESKTOP_WINDOW_ID", False);
-      root = RootWindow (display, screen_number);
 
       Window unused, *windows = 0;
       unsigned int count;
@@ -245,6 +244,8 @@ find_root_window (Display *display, int screen_number)
       unsigned long nitems, bytes_after_return;
       unsigned char *virtual_root_window;
 
+      root = RootWindow (display, screen_number);
+
       if (XGetWindowProperty (display, root, NAUTILUS_DESKTOP_WINDOW_ID,
                               0, 1, False, XA_WINDOW, &type, &format,
                               &nitems, &bytes_after_return,
@@ -742,7 +743,7 @@ lineinput (struct logfile_entry *logfile)
  * in case of error, file->fp is NULL
  */
 FILE *
-openlog (struct logfile_entry * file)
+open_log (struct logfile_entry * file)
 {
   struct stat stats;
 
@@ -786,7 +787,7 @@ reopen (void)
       if (e->fp)
         fclose (e->fp);
       /* if fp is NULL we will try again later */
-      openlog (e);
+      open_log (e);
     }
 
   do_reopen = 0;
@@ -808,7 +809,7 @@ check_open_files (void)
           sleep (1);
           if (e->fp)
             fclose (e->fp);
-          if (openlog (e) == NULL)
+          if (open_log (e) == NULL)
             continue;
           if (fstat (fileno (e->fp), &stats) < 0)
             continue;
@@ -818,7 +819,7 @@ check_open_files (void)
         {                       /* file renamed? */
           if (e->fp)
             fclose (e->fp);
-          if (openlog (e) == NULL)
+          if (open_log (e) == NULL)
             continue;
           if (fstat (fileno (e->fp), &stats) < 0)
             continue;
@@ -1418,7 +1419,7 @@ main (int argc, char *argv[])
             {
               e->fname = xstrdup (fname);
 
-              if (openlog (e) == NULL)
+              if (open_log (e) == NULL)
                 perror (fname), exit (1);
 
               e->desc = xstrdup (desc);
